package ace.module.account.core.impl.controller.rest.rpc.callback;

import ace.cmp.security.oauth2.resource.server.core.annotation.PreAuthorizeIsInternalClient;
import ace.module.account.core.impl.service.callback.auth.Oauth2AuthenticationCallbackService;
import ace.module.account.sdk.core.feign.impl.IamOauth2Feign;
import ace.module.common.api.annotation.ApiRemoteImplementPriority;
import ace.module.oauth2.callback.contract.feign.Oauth2AceAuthenticationCallbackFeign;
import ace.module.oauth2.server.api.callback.model.input.Oauth2AceAuthenticationCallbackInput;
import ace.module.oauth2.server.api.model.dto.ext.Oauth2AceAuthResultDto;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * .
 *
 * @author Caspar
 */
@Tag(name = "通用账户oauth2认证与授权回调-RPC-API")
@AllArgsConstructor
@PreAuthorizeIsInternalClient
@RestController
@RequestMapping(IamOauth2Feign.PATH)
@ApiRemoteImplementPriority
public class IamOauth2AuthenticationCallbackRpcController
    implements Oauth2AceAuthenticationCallbackFeign {

  private final Oauth2AuthenticationCallbackService oauth2AuthenticationCallbackService;

  @Override
  public Oauth2AceAuthResultDto authentication(Oauth2AceAuthenticationCallbackInput input) {
    return oauth2AuthenticationCallbackService.authenticationByConfig(input);
  }
}
